<html>
<head>
    <title>业务流程用户代理配置列表</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <link href="../../build/common/base.css" rel="stylesheet">
    <script type="text/javascript" src="../../build/common/base.js"></script>
    <script type="text/javascript" src="../../build/common/gridList.js"></script>
    <script type="text/javascript">
        var tab = $.getParam('tab')
    </script>
</head>
<body style="height: 85%;">
<div class="btn-group toolbar">
    <button class="btn btn-outline btn-primary fa-plus" openDialog="新增配置" url="./userAgencyConfigEdit.html">新增</button>
</div>
<!-- 数据列表 ab-grid -->
<table ab-grid data-id-field="id" data-url="/bpm/userAgencyConfig/tabList?tab={ tab }">
    <thead>
    <tr>
        <th data-checkbox="true">ID</th>
        <th data-field="startDatetime" data-formatter=dateTimeFormatter>起始时间</th>
        <th data-field="endDatetime" data-formatter=dateTimeFormatter>结束时间</th>
        <th data-field="agencyFlowName">代理流程</th>
        <th data-field="targetUserName">代理用户</th>
        <th data-field="createTime" data-formatter=dateTimeFormatter>创建时间</th>
        <th data-field="id" data-formatter="innerHtmlFormatter" data-title="管理">
            <a class='btn btn-outline btn-primary fa  fa-trash' if="tab == 'WAIT_EFFECT'" qtip="删除" sendAction='删除'
               url='/bpm/userAgencyConfig/remove?id={ id }'></a>
            <a class='btn btn-outline btn-primary fa fa-tasks' if="tab != 'WAIT_EFFECT'"
               onClick="showLog('{ id }','{ startDatetime }', '{ endDatetime }', '{ agencyFlowName }')">代理记录</a>
            <a class='btn btn-outline btn-primary fa fa-ban' if="tab == 'TAKE_EFFECTING'" qtip="取消" sendAction='取消' url="/bpm/userAgencyConfig/disable?id={ id }"></a>

        </th>
    </tr>
    </thead>
</table>
<script type="text/javascript">
    function showLog(id, startDatetime, endDatetime, agencyFlowName) {
        top.addTab({
            'name': startDatetime + '~' + endDatetime + '-' + agencyFlowName + '代理记录',
            'url': 'bpmplugin/userAgencyConfig/userAgencyLogList.html?configId=' + id,
            'id': id
        }, false)
    }
</script>
</body>
</html>